import java.io.*;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lishuo
 * Date: 2023-04-20
 * Time: 10:56
 */

// 读取英文字符文件
public class Test {
    public static void main(String[] args) throws IOException {
        try (OutputStream os = new FileOutputStream("test03.txt")) {
            String s = "hello world,你好世界！";
            byte[] b = s.getBytes("utf-8"); //返回一个 byte 数组
            os.write(b);

            // 不要忘记 flush
            os.flush();
        }
    }
}




























